const UserModel = require('../model/UserModel');

const UserService = {
    addUser: (obj) => {
        const {name,password,age} = obj;
        return UserModel.create({
            name,
            password,
            age
        });
    },
    findAll: () => {
        return UserModel.find({});
    },
    findOne: (obj) => {
        const {name,age,password} = obj;
        return UserModel.findOne({
            name,
            age,
            password
        });
    }
};

module.exports = UserService;